package com.hqyj.controller;


import com.hqyj.pojo.TbEstateManager;
import com.hqyj.service.TbEstateManagerService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * <p>
 * 物业管理人员表 前端控制器
 * </p>
 *
 * @author gp
 * @since 2021-09-26
 */
@RestController
@RequestMapping("/tb-estate-manager")
public class TbEstateManagerController {
    @Autowired
    TbEstateManagerService tbEstateManagerService;

    /**
    * @Author:YaoHaoHong
    * @Description:
     * 查询
     * 127.0.0.1:8080/tb-estate-manager/list ---- get
    * @Date:2021/10/8 9:11
    */
    @GetMapping("/list")
    HashMap<String,Object> list(TbEstateManager tbEstateManager){
        return tbEstateManagerService.list(tbEstateManager);
    }
    /**
    * @Author:YaoHaoHong
    * @Description:
     * 添加
     * 127.0.0.1:8080/tb-estate-manager/add ---- post
    * @Date:2021/10/8 9:24
    */
    @PostMapping(value = "/add",consumes = "application/json")
    HashMap<String ,Object> add (@RequestBody TbEstateManager tbEstateManager){
        return tbEstateManagerService.insert(tbEstateManager);
    }
    /**
    * @Author:YaoHaoHong
    * @Description:
     * 修改
     * 127.0.0.1:8080/tb-estate-manager/update ---- put
    * @Date:2021/10/8 9:26
    */
    @PutMapping(value = "/update",consumes = "application/json")
    HashMap<String ,Object> update(@RequestBody TbEstateManager tbEstateManager){
        return tbEstateManagerService.update(tbEstateManager);
    }
    /**
    * @Author:YaoHaoHong
    * @Description:
     * 删除
     * 127.0.0.1:8080/tb-estate-manager/del ---- delete
    * @Date:2021/10/8 9:28
    */
    @DeleteMapping(value ="/del/{id}")
    HashMap<String ,Object> delete(@PathVariable Integer id){
        return tbEstateManagerService.delete(id);
    }
}

